<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<head>
    <title>定制-笔飞美术作品</title>
    <script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
    <%@include file="../common/jspcommon.jsp"%>
	<%@include file="../common/css.jsp"%>
  <link rel="stylesheet" type="text/css" href="/css/style_dz.css" />
    <title>艺术家页面-笔飞美术作品</title>
	 <link rel="stylesheet" type="text/css" href="/css/lightbox.css" />
	 <script type="text/javascript" src="js/jquery.validate.js"></script>
</head>
<body>
<div id="box">
    <%@include file="../common/header.jsp" %>
    <div id="main_div">
        <div class="site_map"><a href="/welcome.htm">首页</a> 》<a href="made.htm">定制</a> 》在线定制</div>
        
        <div id="dz_div_7">
            <div class="dz_div_7_l">
                <p><b>定制${artist.name}的作品</b></p>
                <form id="madeArt"  method="post">
                <table cellpadding="10" cellspacing="0" border="0" class="dz_table mt20">
                    <tr>
                        <td class="dz_td_1" valign="top">标题</td>
                        <td class="dz_td_2"><input id="title" name="title" type="text" class="dz_input" /><br />一句话简单描述您的要求</td>
                    </tr>
                    <tr>
                        <td class="dz_td_1" valign="top">详细内容</td>
                        <td><textarea id="content" name="content" cols="20" rows="2" class="dz_input" style="height:160px;"></textarea><br />请尽量详细描述您的要求，例如：主题、尺寸、要求完成时间，查看右边的常见问题，可能会给您帮助。</td>
                    </tr>
                    <tr>
                        <td class="dz_td_1" valign="top">地点</td>
                        <td class="dz_td_2">
                            <select id="province" class="dz_sel">
                                <option value="0">选择省</option>
                            </select>
                            <select id="city" class="dz_sel mt10">
                                <option value="0">选择市</option>
                            </select>
                            
                            <input id="address" name="address" type="text" class="dz_sel mt10" value="填写详细地址" onfocus="if (this.value=='填写详细地址')this.value=''" onblur="if (this.value=='')this.value='填写详细地址'" />
                        </td>
                    </tr>
                    <tr>
                        <td class="dz_td_1" valign="top">邮箱<input id="artistId" type="hidden" value="${artist.id}"/></td>
                        <td class="dz_td_2"><input id="email" name="email" type="text" class="dz_input" /></td>
                    </tr>
                    <tr>
                        <td class="dz_td_1" valign="top">姓名</td>
                        <td class="dz_td_2"><input id="madeName" name="madeName" type="text" class="dz_input" /></td>
                    </tr>
                    <tr>
                        <td class="dz_td_1" valign="top">手机</td>
                        <td class="dz_td_2"><input id="phone" name="phone" type="text" class="dz_input" /></td>
                    </tr>
                    <tr>
                        <td class="dz_td_1" valign="top"></td>
                        <td class="dz_td_2"><input id="Submit1" type="submit" value="" class="dz_submit" /></td>
                    </tr>
                </table>
                </form>
            </div>
            <div class="dz_div_7_r">
            	<c:forEach items="${madeArtRight}" var="right">
	                <p class="style6 mt10">${right.title }</p>
	                <p class="mt10">${right.description}</p>
                </c:forEach>
            </div>
        </div>
      <%@include file="../common/footer.jsp" %>
    </div>
</div>
<script type="text/javascript">
	initProvince('province', 'city','county');
	$("#madeArt").validate(
		{
			rules : {
				title : {
					required : true,
					minlength : 2,
					maxlength : 40
				},
				content : {
					required : true,
					minlength : 10,
					maxlength : 500
				} ,
				address : {
					required : true,
					minlength : 2,
					maxlength : 40
				} ,
				email : {
					required : true,
					minlength : 2,
					maxlength : 20
				} ,
				phone : {
					required : true,
					minlength : 2,
					maxlength : 20
				} ,
				madeName : {
					required : true,
					minlength : 2,
					maxlength : 20
				} 
			},
			messages : {
				title : {
					required : "请填写标题",
					minlength : "长度为2～40位",
					maxlength : "长度为2～40位"
				},
				content:{
					required : "请填写详细内容",
					minlength : "长度为10～500位",
					maxlength : "长度为10～500位"
				},
				address:{
					required : "请填写地址",
					minlength : "长度为2～40位",
					maxlength : "长度为2～40位"
				},
				email:{
					required : "请填写邮编",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				},
				phone:{
					required : "请填写手机",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				},
				madeName:{
					required : "请填写定制人的姓名",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				}
			},
			submitHandler : function() {
				var artistId=$("#artistId").val();
				//alert(artistId);
				 if(artistId.length <0){
					 alert("很遗憾，页面失效了~");
					return false; 
				}
				 if(ART.checkLogin()){
						$.post("saveMade.htm", {
							provinceCode : $("#province").val(),
							cityCode : $("#city").val(),
							province : $("#province").find("option:selected").text(),
							city : $("#city").find("option:selected").text(),
							title : $("#title").val(),
							email : $("#email").val(),
							address : $("#address").val(),
							content : $("#content").val(),
							phone : $("#phone").val(),
							madeName : $("#madeName").val(),
							artistId:artistId
							}, function(data) {
								if (data == 'success') {
									alert("定制成功！等待艺术家评估！");
									window.location.href="/mMade.htm"
								} else{
									alert("很抱歉，定制失败了。");
								}
							});
				 } else{
						alert("请登录哦~");
						window.location.href="login.htm"
					}
			}
		});
	</script>
</body>
</html>
